﻿@using KMF.Common
@using KMF.WebUI.Areas.KMFadmin.CustomHelpers
@using KMF.WebUI.Areas.KMFadmin.Models
@model KMF.Common.ProductCategoryBannerDto

@{
    ViewBag.Title = "CategoryBannerAdd";
    Layout = "~/Areas/KMFadmin/Views/Shared/_layout.cshtml";
}


<link href="~/Areas/KMFadmin/Content/css/browerImage.css" rel="stylesheet" />
<link href="~/Areas/KMFadmin/Scripts/jQueryDatePicker/css/ui-lightness/jquery-ui-1.10.1.custom.min.css" rel="stylesheet" />
<link href="~/Areas/KMFadmin/Scripts/jQueryDatePicker/js/jquery-ui-timepicker-addon.css" rel="stylesheet" />

<nav>
    <div id="jCrumbs" class="breadCrumb module">
        <ul>
            <li><a href="@Url.Action("Index", "AdminHome")"><i class="bootstrap icon-home"></i></a></li>
            <li><a href="@Url.Action("Index", "AdminProductCategory")">Danh mục</a> </li>
            <li><a href="javascript:vói(0)">Thêm category banner</a> </li>
        </ul>
    </div>
</nav>

<div class="toolBox">
    @Html.ToolBox(new List<object> { new Add { ClassCss = "Add", ActionName = "Javascript:void(0)" } ,
    new Back{ ClassCss = "Back",ActionName = @Url.Action("CategoryBanner","AdminProductCategory") } })
</div>

@using (Html.BeginForm("CategoryBannerAdd", "ADminProductCategory", FormMethod.Post, new { @class = "formAddCate", enctype = "multipart/form-data" }))
{
    <div class="box-Info">
        <div class="Info-header">
            <span>Thêm thông tin</span>
        </div>

        <div class="Info-body ib-infopro">
            <div>@Html.ValidationMessage("ErrorSummary")</div>
            <table cellpadding="0" cellspacing="0" width="100%" border="0" class="table-info">
                <tr>
                    <td class="tInfoLeft">Tên banner
                    </td>
                    <td class="tInfoRight">
                        @Html.TextBoxFor(m => m.BannerName)
                        @Html.ValidationMessageFor(m => m.BannerName)
                    </td>
                </tr>
                <tr>
                    <td class="tInfoLeft">Mô tả
                    </td>
                    <td class="tInfoRight">
                        @Html.TextBoxFor(m => m.Description)
                    </td>
                </tr>
                <tr>
                    <td class="tInfoLeft">Thuộc Danh Mục
                    </td>
                    <td class="tInfoRight">
                        <i>Chỉ chọn danh mục cấp 1</i><br />
                        @Html.DropDownListFor(m => m.CategoryId, new SelectList((List<ProductCategoryDto>)ViewBag.ParentList, "Id", "Name"))
                    </td>
                </tr>
                <tr>
                    <td class="tInfoLeft">Hình Ảnh
                    </td>
                    <td class="tInfoRight">
                        <input type="file" name="fileImagePath" /><br />
                    </td>
                </tr>
                <tr>
                    <td class="tInfoLeft">Url
                    </td>
                    <td class="tInfoRight">
                        @Html.TextBoxFor(m => m.Url)
                    </td>
                </tr>
                <tr>
                    <td class="tInfoLeft">Thứ tự
                    </td>
                    <td class="tInfoRight">
                        @Html.TextBoxFor(m => m.Ordering, new { @style = "width:50px;" })
                    </td>
                </tr>
                <tr>
                    <td class="tInfoLeft">Kích thước
                    </td>
                    <td class="tInfoRight">Width
                        @Html.TextBoxFor(m => m.Width, new { @style = "width:50px;" })
                        Height
                        @Html.TextBoxFor(m => m.Height, new { @style = "width:50px;" })
                    </td>
                </tr>
                <tr>
                    <td class="tInfoLeft">Thời gian
                    </td>
                    <td class="tInfoRight">Ngày bắt đầu
                        @Html.TextBoxFor(m => m.BeginDate, new { @class = "cssInputWidthSmall", data_val = false })
                        @Html.ValidationMessageFor(m => m.BeginDate)
                        Ngày kết thúc
                        @Html.TextBoxFor(m => m.EndDate, new { @class = "cssInputWidthSmall", data_val = false })
                        @Html.ValidationMessageFor(m => m.EndDate)
                       
                    </td>
                </tr>
                <tr>
                    <td class="tInfoLeft">Kích hoạt
                    </td>
                    <td class="tInfoRight">
                        @Html.CheckBoxFor(m => m.Active, new { @checked = true })
                    </td>
                </tr>
            </table>
        </div>
    </div>
}

@section scripts
{
    @Scripts.Render("~/bundles/KMFAdmin/jqueryval")
    <script src="@Url.Content("~/Areas/KMFadmin/Scripts/jQueryDatePicker/js/jquery-ui-1.10.1.custom.min.js")"></script>
    <script src="@Url.Content("~/Areas/KMFadmin/Scripts/jQueryDatePicker/js/jquery-ui-timepicker-addon.js")"></script>

    <script>
        $(function () {


            SubmitFormUseToolBox($('ul li.Add a'), $('form'));

            // Date picker
            $('#BeginDate').datepicker({
                dateFormat: 'dd/mm/yy'
            });
            $('#EndDate').datepicker({
                dateFormat: 'dd/mm/yy'
            });

            //$('#chkTimeUnlimit').click(function() {
            //    var chk = $(this).attr('checked');
            //    if (chk == undefined) {
            //        $('#BeginDate').removeAttr('disabled');
            //        $('#EndDate').removeAttr('disabled');
            //        $('#BeginDate').val('');
            //        $('#EndDate').val('');
            //    } else {
            //        $('#BeginDate').attr('disabled', 'disabled');
            //        $('#EndDate').attr('disabled', 'disabled');
            //        $('#BeginDate').val('01/01/0001');
            //        $('#EndDate').val('31/12/9999');
            //    }
            //});
        });
    </script>
}

